home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
Transport
/
src
/
InetDatagram.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
866b
|
51 lines
#include <stdio.h>
#include <osfcn.h>
#include <libc.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <iostream.h>
#include "Transport.h"
#include <RJS/Util.h>
int RJS_InetDatagram::socket()
{
RJS_InetAddress temp(RJS_InetAddress::Any,0);
if (inuse()) close();
if (RJS_Socket::socket() && bind(temp)) {
ss_set(SS_success);
sex=Unknown;
return 1;
}
if (!return_on_error)
RJS_Util::crash_and_burn("InetDatagram","open",ss_message());
return 0;
}
int RJS_InetDatagram::active()
{
int stat=RJS_InetDatagram::socket();
sex=Active;
return stat;
}
int RJS_InetDatagram::passive(const RJS_InetAddress &is)
{
if (inuse()) close();
if (RJS_Socket::socket() && bind(is)) {
ss_set(SS_success);
sex=Passive;
return 1;
}
if (!return_on_error)
RJS_Util::crash_and_burn("InetDatagram","open",ss_message());
return 0;
}